import { IcategorydetailList, ICateList } from '@/types/cateList'
import http from '@/utils/http'

/**
 * @description 获取分类列表的数据
 * @returns
 */
export const reqCateList = () => {
  return http<ICateList>('/item/cateList.json', 'GET')
}

/**
 * @description 获取二级分类列，表的数据
 * @param id 一级分类id
 * @returns
 */
export const reqGoodsList = (id: number) => {
  return http<ICateList>(`/item/cateList.json?categoryId=${id}`, 'GET')
}

/**
 * ，@description 获取某个分类下的商品列表
 * Id 一级分类id
 * subId 二级的id
 * @returns
 */
export const reqItemList = (Id: number, subId: number) => {
  return http<IcategorydetailList>(`/item/list.json?categoryId=${Id}&subCategoryId=${subId}`, 'GET')
}
